package part3.c14_strategy;

/**
 * Created by lie on 2018/3/23.
 * intSortHandle将不会知道它是被何种排序方法排序的
 */
public class IntSortHandle implements SortHandle {
    private int[] array;

    public boolean isNeedSwap(int index) {

        return this.array[index] > this.array[index+1];
    }

    public void swap(int index) {
        int temp = this.array[index +1];
        this.array[index + 1] = array[index];
        array[index] = temp;
    }

    public int length() {
        return this.array.length;
    }

    public void setArray(Object array) {
        this.array = (int[]) array;
    }
}
